import request from '@/apis/request';
import { GENERAL_REMOTE_OPTIONS } from '@/constants';
// 根据下拉框类型和项目所属获取下拉框数据
const findBySelectNameDefaultUrl = '/child/CommonDropoptionControl/findBySelectNameDefault'
// 各列表接口路径
const welfareorgsGetWelfareOrgsList = '/child/welfareorgs/getWelfareOrgsList'
const newChildEvaluatesGetReportList = '/child/newChildEvaluates/getReportList'


// login 登录接口
export const doLoginApi = (data?: object) => {
    return request({
        url: '/child/child/login/doLogin',
        method: 'post',
        data
    },true, true);
}
// 根据下拉框类型和项目所属获取下拉框数据
export const getUploadImageApi = (url?: string, data?: object) => {
    return request({
        url,
        method: 'post',
        data
    },false, true);
}
// 行政区划
export const getCityOptionApi = (data?: object) => {
    return request({
        url: '/child/childCity/getChildCityList',
        method: 'post',
        data
    },false, true);
}
// excel公共导出

export const customizeExportApi = (data?: object, url?: string) => {
    return request({
        // url: '/child/childExcelExport' + url + '/customizeExport',
        url: url + '/customizeExport',
        method: 'post',
        data
    },true, true);
}
// 福利机构列表导出
export const welfareorgsGetWelfareOrgsListCustomizeExportApi = (data?: object) => {
    return customizeExportApi(data, welfareorgsGetWelfareOrgsList)
}
// 风险等级列表导出
export const newChildEvaluatesGetReportListCustomizeExportApi = (data?: object) => {
    return customizeExportApi(data, newChildEvaluatesGetReportList)
}

// 默认的
export const findBySelectNameDefaultApi = (data?: object) => {
    return request({
        url: findBySelectNameDefaultUrl,
        method: 'post',
        data
    },false, true);
}
// let findBySelectNameDefaultApis = new Array(GENERAL_REMOTE_OPTIONS.length);
// for (let i = 0; i < GENERAL_REMOTE_OPTIONS.length; i++) {
//     findBySelectNameDefaultApis[i] = (data?: object) => {
//         return request({
//             url: findBySelectNameDefaultUrl,
//             method: 'post',
//             data: {
//                 name: GENERAL_REMOTE_OPTIONS[i].name
//             }
//         },false, true);
//     }
// }
// export const findBySelectNameDefault0Api = findBySelectNameDefaultApis[0]
// export const findBySelectNameDefault1Api = findBySelectNameDefaultApis[1]

// 福利机构
// 福利机构列表
export const welfareorgsGetWelfareOrgsListApi = (data?: object) => {
    return request({
        url: welfareorgsGetWelfareOrgsList,
        method: 'post',
        data
    },false, true);
}
// 查看福利机构信息
export const welfareorgsGetWelfareOrgsInfoApi = (data?: object) => {
    return request({
        url: '/child/welfareorgs/getWelfareOrgsInfo',
        method: 'post',
        data
    },true, true);
}
// 新增更新福利机构
export const welfareorgsAddChildInfoApi = (data?: object) => {
    return request({
        url: '/child/welfareorgs/addChildInfo',
        method: 'post',
        data
    },true, true);
}
// 四色评估
// 风险等级列表
export const newChildEvaluatesGetReportListApi = (data?: object) => {
    return request({
        url: newChildEvaluatesGetReportList,
        method: 'post',
        data
    },false, true);
}
// 风险等级查看评估报告打印
export const childEvaluateGetReportPdfApi = (data?: object) => {
    return request({
        url: '/social/childEvaluate/getReportPdf',
        method: 'post', 
        data
    },true, true);
}
